#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	int arr[100005];
	for (int i = 0; i < n; i++) {
		scanf("%d", &arr[i]);
	}
	for (int i = 0; i < m; i++) {
		int temp = 0;
		scanf("%d", &temp);
		int l = 0, r = n - 1;
		while (l != r) {
			int mid = (l + r + 1) / 2;
			if (arr[mid] <= temp) {
				l = mid;
			}
			else {
				r = mid - 1;
			}
		}
		if (i) {
			printf(" ");
		}
		printf("%d", arr[l]);
	}
	return 0;
}